;(function() {
	function Router() {
		this.currentUrl = '';
		this.routes = {};
	}

	Router.prototype.route = function(path, callback) {
		this.routes[path] = callback || function() {};
	}

	Router.prototype.refresh = function() {
		var hash = location.hash.slice(1);
		if(hash === '') {
			this.currentUrl = '/';
		} else {
			this.currentUrl = hash;
		}
		this.routes[this.currentUrl]();
	}

	Router.prototype.init = function() {
		window.addEventListener('load', this.refresh.bind(this), false);
		window.addEventListener('hashchange', this.refresh.bind(this), false);
		return this;
	}
	//exports
	window.getRouter=function () {
		return new Router().init();
	};
})();